import { createWebHistory, createRouter } from 'vue-router'

import Menu from './views/Menu.vue'
import Button from './views/Button.vue'
import Input from './views/Input.vue'
import Selector from './views/Selector.vue'
import PopupSelector from './views/PopupSelector.vue'
import ImageUploader from './views/ImageUploader.vue'
import Attachment from './views/Attachment.vue'
import Month from './views/Month.vue'
import Switch from './views/Switch.vue'
import SortableInput from './views/SortableInput.vue'

// 展示组件
import Placeholder from './views/Placeholder.vue'
import Popup from './views/Popup.vue'
import RedDot from './views/RedDot.vue'
// 反馈组件
import Loading from './views/Loading.vue'
import LicensePlateInput from './views/LicensePlateInput.vue'
import UserPicker from './views/UserPicker.vue'

const routes = [
  {
    path: '/',

    redirect: {
      path: '/menu'
    }
  },
  {
    path: '/menu',
    component: Menu
  },
  { path: '/input', component: Input },
  {
    path: '/button',
    component: Button
  },
  {
    path: '/selector',
    component: Selector
  },
  {
    path: '/popupSelector',
    component: PopupSelector
  },
  {
    path: '/month',
    component: Month
  },
  {
    path: '/switch',
    component: Switch
  },
  { path: '/imageUploader', component: ImageUploader },
  { path: '/attachment', component: Attachment },
  { path: '/sortableInput', component: SortableInput },

  // 展示组件
  {
    path: '/fieldGroup',
    component: () => import('./views/FieldGroup.vue')
  },
  {
    path: '/placeholder',
    component: Placeholder
  },
  {
    path: '/popup',
    component: Popup
  },
  { path: '/redDot', component: RedDot },
  // 反馈组件
  {
    path: '/loading',
    component: Loading
  },
  // 业务组件
  {
    path: '/licensePlateInput',
    component: LicensePlateInput
  },
  {
    path: '/userPicker',
    component: UserPicker
  },

  {
    path: '/:pathMatch(.*)*',
    redirect: {
      path: '/'
    }
  }
]

const router = createRouter({ history: createWebHistory(import.meta.env.VITE_CONTEXT_PATH), routes })

export default router
